<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">


    <h:body>
        <ui:composition template="../communityTemplate.xhtml">
            
            <ui:define name="left">
                <ul>
                    <li>
                        <a href="/RomaCommunityv1/PrivateMessage/listmessages.jsf">List messages</a>
                    </li>
                    
                    <li>
                        <a href="/RomaCommunityv1/PrivateMessage/sendmessage.jsf">Send message</a>
                    </li>
                </ul>
                
            </ui:define>
            
            
            <ui:define name="content">
                <p:panel header="Inbox" toggleable="TRUE">
                    <h:form>  
                        <p:dataTable var="message" value="#{listMessagesBean.receivedMessages}" id="table1" rows="5" rendered="true" paginator="TRUE" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,20,50,100">  
                            <p:column>  
                                <f:facet name="header">  
                                    Time sent  
                                </f:facet>  
                                <h:outputText value="#{message.modifiedDateString}" />  
                            </p:column>  

                            <p:column>  
                                <f:facet name="header">  
                                    Sender  
                                </f:facet>  
                                <h:outputText value="#{message.sender}" />  
                            </p:column> 
                            <p:column id="action"> 
                                <h:commandButton value="View" action="#{listMessagesBean.goToDetails}" actionListener="#{listMessagesBean.selectionListener}">
                                    <f:attribute name="selection" value="#{message}"/>
                                </h:commandButton>
                            </p:column>



                        </p:dataTable>  
                        <p:poll interval="5" update="table1" widgetVar="poll" autoStart="true"/> 
                    </h:form>  
                </p:panel>
                
                

                <p:panel header="Outbox" toggleable="TRUE">
                    <h:form>  
                        <p:dataTable var="message" value="#{listMessagesBean.sentMessages}" id="table1" rows="5" rendered="true" paginator="TRUE" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,20,50,100">  
                            <p:column>  
                                <f:facet name="header">  
                                    Time sent  
                                </f:facet>  
                                <h:outputText value="#{message.timesent}" />  
                            </p:column>  

                            <p:column>  
                                <f:facet name="header">  
                                    Receiver  
                                </f:facet>  
                                <h:outputText value="#{message.receiver}" />  
                            </p:column>  

                            <p:column id="action"> 
                                <h:commandButton value="View" action="#{listMessagesBean.goToDetails}" actionListener="#{listMessagesBean.selectionListener}">
                                    <f:attribute name="selection" value="#{message}"/>
                                </h:commandButton>
                            </p:column>



                        </p:dataTable>  
                        <p:poll interval="5" update="table1" widgetVar="poll" autoStart="true"/> 
                    </h:form>  
                </p:panel>
            </ui:define>
        </ui:composition>
    </h:body>

</html>

